<?php
require_once('configure.php');
$kodepos = isset($_GET['kodepos']) ? $_GET['kodepos'] : "";
$data = isset($_GET['p']) ? $_GET['p'] : "";

$query = "SELECT * FROM kodepos WHERE kodepos ='{$kodepos}'";
//print($query);
$result = my_query($query);
if( my_num_rows($result) > 0 ){
	$row = my_fetch_array($result);
	 
	if($data == 'kelurahan'){
		echo $row['kelurahan'];
	}
	elseif($data == 'kecamatan'){
		echo $row['kecamatan'];
	}
	elseif($data == 'kota'){
		echo $row['kota'];
	}
	elseif($data == 'propinsi'){
		echo $row['propinsi'];
	}else{
		echo $row['kodepos'];
	}
}
return NULL;